//---------------------------------------------------------------------------

#ifndef uCalculatriceH
#define uCalculatriceH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include "CEdit.h"
#include <Menus.hpp>
#include <ComCtrls.hpp>
#include <CForm.h>
//---------------------------------------------------------------------------
typedef void __fastcall (__closure *TOnSetValue)(const AnsiString &aValue);

class TfCalculatrice : public CForm
{
__published:	// Composants gérés par l'EDI
    TPanel *pCalc;
    TButton *btnC;
    TButton *btnRetour;
    TButton *btnPlusMoins;
    TButton *btnDiviser;
    TButton *btn4;
    TButton *btn5;
    TButton *btn6;
    TButton *btnMoins;
    TButton *btn1;
    TButton *btn2;
    TButton *btn3;
    TButton *btnPlus;
    TButton *btnPoint;
    TButton *btn0;
    TButton *btnPourcent;
    TButton *btnEgale;
    TButton *btnOK;
    TButton *btn7;
    TButton *btn8;
    TButton *btn9;
    TButton *btnMultiplie;
    CEdit *eResult;
    void __fastcall btnClick(TObject *Sender);
    void __fastcall btnOperationClick(TObject *Sender);
    void __fastcall btnCKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
    void __fastcall btnEgaleClick(TObject *Sender);
    void __fastcall btnOKClick(TObject *Sender);
    void __fastcall FormDeactivate(TObject *Sender);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall FormShow(TObject *Sender);
    void __fastcall btnPlusMoinsClick(TObject *Sender);
    void __fastcall btnRetourClick(TObject *Sender);

private:	// Déclarations utilisateur
    void __fastcall Init();
    void __fastcall Calc();
    AnsiString __fastcall Arrondi(AnsiString asValue);
    void __fastcall MyWndProc(Messages::TMessage &Message);
private:	// Déclarations utilisateur
    AnsiString asOldValue;
    AnsiString asResultat;
    AnsiString asOperateur;
    bool    bNewValue;
    bool    bOperationEnCours;
    bool    bPourcent;
    TWndMethod OldWndProc;
    TOnSetValue m_OnSetValue;
public:		// Déclarations utilisateur
    __fastcall TfCalculatrice(TComponent* Owner);
    void __fastcall AfficherCalc (TControl *CtrlAppelant, const AnsiString &asValue, TOnSetValue OnSetValue);

public:
    bool bRemplaceVal;
protected:

};
//---------------------------------------------------------------------------
#endif
